function Set-InsightDatabase {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)][LSInsightServer]$Server,
        [Parameter(Mandatory = $true)][LSInsightDatabase]$Database,
        [Parameter(Mandatory = $true)][string][ValidateScript({ !([string]::IsNullOrWhiteSpace($_)) })]$ResourceGroup,
        [Parameter(Mandatory = $true)][string][ValidateScript({ !([string]::IsNullOrWhiteSpace($_)) })]$Location,
        [Parameter(Mandatory = $true)][string][ValidateScript({ $_ -ne 'Undefined' })]$Placement
    )

    # Get config settings.
    $config = Read-Config

    # Create Azure SQL database if necessary.
    if ($Placement -eq 'In_Azure' -and $Database.UseExisting -eq 'False') {
        Write-Host # Newline.
        Write-Host "Creating a new Azure SQL database. This might take a few minutes..."
        $params = @{
            ResourceGroup = $ResourceGroup
            ServerName = $Server.Name
            LSInsightCredential = $Server.Credential
            DatabaseName = $Database.Name
            PricingTier = $Database.PricingTier
            SASToken = $config.SASToken
            BacPacFile = $config.BacPacUrl
        }
        New-AzureSQLDatabase @params
    }
}